//-----------------------------------------------------------------------
// <copyright file="QuangCaoServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using APPro.Entities;
using APPro.Data;
    
namespace APPro.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class QuangCaoServiceBase
    {
        #region QuangCaoServiceBase

        public static void CreateQuangCao(QuangCao quangCao)
        {            
            try
            {
                QuangCaoDAO quangCaoDAO = new QuangCaoDAO();
                quangCaoDAO.CreateQuangCao(quangCao);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreateQuangCaoException, ex);
            }
        }

        public static void UpdateQuangCao(QuangCao quangCao)
        {            
            try
            {
                QuangCaoDAO quangCaoDAO = new QuangCaoDAO();
                quangCaoDAO.UpdateQuangCao(quangCao);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdateQuangCaoException, ex);
            }
        }        

        public static void DeleteQuangCao(int maQuangCao)
        {            
            try
            {
                QuangCaoDAO quangCaoDAO = new QuangCaoDAO();
                quangCaoDAO.DeleteQuangCao(maQuangCao);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeleteQuangCaoException, ex);
            }
        }
		
        public static QuangCao GetQuangCao(int maQuangCao)
        {            
            try
            {
                QuangCaoDAO quangCaoDAO = new QuangCaoDAO();
                return quangCaoDAO.GetQuangCao(maQuangCao);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetQuangCaoException, ex);
            }
        }                
		
        public static QuangCaoCollection GetQuangCaoList(QuangCaoColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                QuangCaoDAO quangCaoDAO = new QuangCaoDAO();
                return quangCaoDAO.GetQuangCaoList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetQuangCaoListException, ex);
            }
        }        

        public static QuangCaoCollection GetQuangCaoList(QuangCaoColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                QuangCaoDAO quangCaoDAO = new QuangCaoDAO();
                return quangCaoDAO.GetQuangCaoList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetQuangCaoListException, ex);
            }
        }        
		
		
        #endregion
    }
}